class FrameUtil{
    constructor(){
        //当前的帧序号
        this.currentFrame = 0;
        //起始帧，用于计算FPS
        this.sFrame = 0;
        this.sTime = new Date();
        //真实FPS
        this.FPS = 0;
    }
    update(){
        this.currentFrame++;
        //判断是否为sTime+1000
        let t = new Date();
        if(t - this.sTime >= 1000){
            this.FPS = this.currentFrame - this.sFrame;
            //更新起始帧
            this.sFrame = this.currentFrame;
            //更新起始时间
            this.sTime = t;
        }
    }
}